﻿using System;

namespace BankSimulation
{
    class Program
    {
        static void Main(string[] args)
        {
            Bank bank = new Bank { Name = "MyBank", Address = "123 Bank St" };
            Account account = new CreditAccount("123456", "John Doe", 15000, 2000);

            ATM atm = new ATM();
            atm.BigMoneyFetched += (sender, e) =>
            {
                Console.WriteLine($"警告: 账号 {e.Account.AccountNumber} 取走大笔金额: {e.Amount}");
            };

            try
            {
                atm.Withdraw(account, 15000);
            }
            catch (BadCashException ex)
            {
                Console.WriteLine($"错误: {ex.Message}");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"错误: {ex.Message}");
            }
        }

        private static void NewMethod()
        {
            throw new NotImplementedException();
        }
    }
}
